import axios from 'axios';
browser.runtime.onMessage.addListener(async function (request, sender, sendResponse) {
  console.log("background request: ", request)
  switch(request.method){
    case 'login':{
      return new Promise(function(resolve, reject){
        axios.get("http://localhost:8000/v1/admin_api/hello", {
          　　params: { 'name': '大力' }
          }).then(function (res) {
          　　console.log("res: ", res)
              resolve({code: 0, result: res.data})
              // sendResponse({code: 0, result: res.data})
          }).catch(function (error) {
            　console.log("error: ", error)
              reject({code: 3})
          });
      })
    }
  }
});